package com.rtx.edi.gatway.listener.impl.orders;

import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.rtx.edi.gatway.cache.EdiApiDataContext;
import com.rtx.edi.gatway.listener.EdiListener;

@Component
public class OrderValidate implements EdiListener{

	@Override
	public void doCustom(EdiApiDataContext apiDataContext) {
		String json = apiDataContext.getSourceRequestStr();
		
		JSONObject orders = JSON.parseObject(json);
		if(!StringUtils.hasLength(orders.getString("externorderkey"))) {
			throw new RuntimeException("externorderkey不能为空");
		}
	}
}
